package com.sghd.fight.module.game.service.skill.effect;

import com.sghd.fight.module.game.config.SkillConfig;
import com.sghd.fight.module.game.core.model.Unit;
import com.sghd.fight.module.game.service.room.IRoom;
import com.sghd.fight.module.game.service.skill.Context;
import com.sghd.pojo.fight.game.SkillReport;
import com.sghd.pojo.fight.game.TargetReport;
import org.apache.commons.collections.MapUtils;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author frank
 * @date 2018-11-23 13:58
 * @desc 风行术
 **/
@Component
public class PopularartEffect implements Effect {
    @Override
    public void execute(Context context, IRoom room, Unit owner, Unit target, Map<String, Object> ctx, SkillReport skillReport, TargetReport targetReport, SkillConfig config) {
        int added = MapUtils.getIntValue(ctx, Effect.POPULARART_ADD);
        owner.setRound(target.getRound() + added);
        skillReport.setRound(-added);
    }

    @Override
    public EffectType getType() {
        return EffectType.SK_POPULARART;
    }
}
